package models

import "gorm.io/gorm"

// 活动表
type Active struct {
	gorm.Model
	Title     string  `gorm:"type:varchar(155);not null;commit:'标题'"`
	Price     float64 `gorm:"type:decimal(10,2);not null;commit:'价格'"`
	Num       int     `gorm:"type:int;not null;commit:'数量'"`
	Address   string  `gorm:"type:varchar(155);not null;commit:'地址'"`
	Tel       string  `gorm:"type:char(11);not null;commit:'电话'"`
	Progress  int     `gorm:"type:int;not null;commit:'拼团进度'"`
	Countdown string  `gorm:"type:varchar(155);not null;commit:'结束时间'"`
	Image     string  `gorm:"type:varchar(155);not null;commit:'图片'"`
}

func (a *Active) ActiveAdd() error {
	return DB.Debug().Create(&a).Error
}

func (a *Active) Derail() error {
	return DB.First(&a).Error
}
